import { Route, Switch } from "react-router-dom";

function layoutRouter(routes, switchProps = {}) {
    return routes ? (
        <Switch {...switchProps}>
            {routes.map((route) => (
                <Route
                    key={route.menuId}
                    path={route.pageUrl}
                    exact={route.isExact == 1}
                    component={require("../views/" + route.component).default}
                ></Route>
            ))}
        </Switch>
    ) : null
}

export default layoutRouter